acspyexmplClientErrorComponent
index
/diska/alma_tmp/ACS/LGPL/CommonSoftware/acspyexmpl/src/acspyexmplClientErrorComponent.py

This example shows a client that:
    logs into manager via PySimpleClient
    activates the ErrorComponent component specified from the command-line
    calls the methods in this component to show examples of error handling
    releases the component
    logs out of manager
 
Error handling examples are encapsulated in the ClientErrorComponent class.
Each method in the class shows an example.
 
What can I gain from this example?
    SimpleClient usage.
    Dealing with errors accessing (remote) components.

 
Modules
       
ACSErrTypeCommon
ACSErrTypeCommonImpl
ACSErrTypeOKImpl
omniORB.CORBA
acsexmplErrorComponent
acstime

 
Classes
       
ClientErrorComponent

 
class ClientErrorComponent
    This class demonstrates error handling when accessing a (remote)
component.
 
When the class is instantiated, it gets a reference to the 
ErrorComponent counterpart throw the manager services provided
by the SimpleClient.
When the destructor is called, the reference to the component is released.
This strategy ensures a clean handling of references to Components.
 
Each of the public methods of the class demonstrates some error handling pattern.
Each method is self-contained and it should never throw exceptions in itself,
but for ACSErrTypeCommon::CouldntAccessComponentEx, to be used when the
reference to the component is not properly initialised.
Other errors are always completely handled internally.
 
  Methods defined here:
TestOk(self)
Here everything should go fine.
 
Parameters: None
 
Returns: None
 
Raises: ACSErrTypeCommonImpl.CouldntAccessComponentExImpl
TestReceiveRemoteCompletion(self)
Example 2: Calls a method that returns a completion
           If the completion contains an error, then:
 
    Catches the exception, 
    prints it locally 
    sends it to the logging system
 
Parameters: None
 
Returns: Nothing
         
Raises: ACSErrTypeCommonImpl.CouldntAccessComponentExImpl
TestReceiveRemoteException(self)
Example 1: Calls a method that throws an exception
           with a stack trace:
    Catches the exception, 
    Adds context information
    Sends it to the logging system
 
Parameters: None
 
Returns: Nothing
 
Raises: ACSErrTypeCommonImpl.CouldntAccessComponentExImpl
__del__(self)
Destructor. Releases ErrorComponent
__init__(self, client, error_comp)
Constructor
 
Parameters: client is a simple client reference
errorComponent is the name of the ErrorComponent
testCORBASystemException(self)
Calls CORBASystemException, with differents depths,
catches the exceptions(if any, there shouldn't be if depth<=0)
testCompletionFromCompletion(self)
Calls completionFromCompletion, with differents depths,
catches the exceptions(if any, there shouldn't be if depth<=0)
testCompletionOnStack(self)
#no point doing this in python
testExceptionFromCompletion(self)
Calls exceptionFromCompletion, with differents depths, 
catches the exceptions(if any, there shouldn't be if depth<=0)
testOutCompletion(self)
Calls outCompletion
testTypeException(self)
Calls typeException, with differents depths,
catches the exceptions(if any, there shouldn't be if depth<=0)

 
Data
        argv = ['/alma/ACS-8.0/Python/bin/pydoc', '-w', 'acspyexmplClientErrorComponent']